package com.examples.calendar.item;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import com.examples.calendar.Days;

public class CalendarMain {
	public static void main(String[] args) {
		Display d = Display.getDefault();
		Shell shell = new Shell(d);
		shell.setLayout(new FillLayout());

		CalendarControl calendarControl = new CalendarControl(shell, SWT.NONE);
		CalendarItem calendarItem;
		Image image = new Image(d, "sort_icon.gif");
		for (int i = 1; i < 32; i++) {
			calendarItem = new CalendarItem(calendarControl, "" + i, SWT.NONE);
			calendarItem.setImage(image);
		}

		for (Days day : Days.values()) {
			CalendarColumn column = new CalendarColumn(calendarControl,
					SWT.NONE);
			column.setText(day.toString());
		}

		calendarControl.setHeaderVisible(true);
		calendarControl.setLinesVisible(true);

		shell.open();
		while (!shell.isDisposed()) {
			if (!d.readAndDispatch()) {
				d.sleep();
			}
		}
		//display.dispose(); //Commented only for SWTShowcase application.

	}

}
